import javax.swing.plaf.basic.BasicInternalFrameTitlePane;

public class Test {

    /**
     * 判断字符串是否回文
     * @param str
     * @return
     */
    //https://www.nowcoder.com/practice/e297fdd8e9f543059b0b5f05f3a7f3b2?tpId=188&&tqId=38638&rp=1&ru=/activity/oj&qru=/ta/job-code-high-week/question-ranking
    public boolean judge (String str) {
        // write code here
        int left = 0;
        int right = str.length()-1;
        while(left < right) {
            char ch1 = str.charAt(left);
            char ch2 = str.charAt(right);
            if(ch1 != ch2) {
                return false;
            }
            left++;
            right--;
        }
        if(left >= right) {
            return true;
        }
        return false;

    }
    /**
     *计算x的平方根
     */
    //https://www.nowcoder.com/practice/09fbfb16140b40499951f55113f2166c?tpId=188&&tqId=38559&rp=1&ru=/activity/oj&qru=/ta/job-code-high-week/question-ranking
    public int sqrt (int x) {
        // write code here
        int tmp = 0;
        tmp = (int)Math.sqrt(x);

        return tmp;
    }



}
